package entity

import (
	"kop/util/date"
	"time"
)

type DailyQuest struct {
	RoleID       int32 `gorm:"type:int;primary_key"`
	DailyQuestID int32 `gorm:"type:int;primary_key"`
	Date         int32 // 日期
	Value        int64
	Finish       bool
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

func (e *DailyQuest) AfterFind() error {

	var d = date.Date(time.Now())
	if e.Date != d {
		e.Value = 0
		e.Date = d
		e.Finish = false
	}

	return nil
}
